/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.pengjunlee.hive.utils;

import java.io.Serializable;

public class ResponseResult implements Serializable{
	
	private static final long serialVersionUID = 1L;

	protected Integer code;
	
	protected String message;
	
	protected Object object;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getObject() {
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	} 
	
	public ResponseResult() {
		
	}
	
	public ResponseResult(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
	
	public static ResponseResult success() {
		ResponseResult result = new ResponseResult();
		result.setCode(200);
		result.setMessage("成功");
		return result;
	}
	
	public static ResponseResult success(Object data) {
		ResponseResult result = new ResponseResult();
		result.setCode(200);
		result.setMessage("成功");
		result.setObject(data);
		return result;
	}
	
	public static ResponseResult failure(String message) {
		ResponseResult result = new ResponseResult();
		result.setCode(-1);
		result.setMessage(message);
		return result;
	}
}
